<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FGElib: Fichero Fuente C:/dev/C++/proyectos/FGElib/FGElib.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Estructuras&nbsp;de&nbsp;Datos</span></a></li>
      <li class="current"><a href="files.html"><span>Archivos</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;archivos</span></a></li>
    </ul>
  </div>
<h1>C:/dev/C++/proyectos/FGElib/FGElib.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> Free Graphics Engine </span>
<a name="l00003"></a>00003 <span class="comment"> 0.0.1a</span>
<a name="l00004"></a>00004 <span class="comment"> dev.hddisseny</span>
<a name="l00005"></a>00005 <span class="comment"> 100510</span>
<a name="l00006"></a>00006 <span class="comment"> Framework completo de la libreria SDL para usar en VC Express 8.</span>
<a name="l00007"></a>00007 <span class="comment">                   Creado por dev.hddisseny - dev.hddisseny@gmail.com </span>
<a name="l00008"></a>00008 <span class="comment">*/</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;FGElib.h&quot;</span>
<a name="l00028"></a><a class="code" href="class_f_g_e___motion.html#a580bf203b80d8712c78dc464b1fb4a21">00028</a> <span class="keywordtype">void</span> <a class="code" href="class_f_g_e___motion.html#a580bf203b80d8712c78dc464b1fb4a21">FGE_Motion::Init</a>( <span class="keywordtype">char</span>* __chTitle )
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030         <span class="keywordflow">if</span> ( SDL_Init ( SDL_INIT_EVERYTHING ) &lt; 0 ) {
<a name="l00031"></a>00031                 exit(1);
<a name="l00032"></a>00032     }
<a name="l00033"></a>00033         SDL_WM_SetCaption ( __chTitle, NULL );
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00056"></a><a class="code" href="class_f_g_e___motion.html#ae678237c3eb52412f79cdcf1424b26f7">00056</a> FGE_Screen * <a class="code" href="class_f_g_e___motion.html#ae678237c3eb52412f79cdcf1424b26f7">FGE_Motion::Window</a> ( <span class="keywordtype">int</span> __w, <span class="keywordtype">int</span> __h, <span class="keywordtype">int</span> __bpp )
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058         __pSurfaceBuffer = SDL_SetVideoMode( __w, __h, __bpp, SDL_HWSURFACE|SDL_DOUBLEBUF );
<a name="l00059"></a>00059         <span class="keywordflow">return</span> 0;
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061 
<a name="l00081"></a><a class="code" href="class_f_g_e___motion.html#aa0a37d7dae5affb3e1a314bd1f2d910d">00081</a> FGE_Screen * <a class="code" href="class_f_g_e___motion.html#aa0a37d7dae5affb3e1a314bd1f2d910d">FGE_Motion::Surface</a> ( <span class="keywordtype">void</span> )
<a name="l00082"></a>00082 {
<a name="l00083"></a>00083         <span class="keywordflow">return</span> __pSurfaceBuffer;
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00102"></a><a class="code" href="class_f_g_e___motion.html#a693775ca444d08642c4694c5982dcf81">00102</a> <span class="keywordtype">void</span> <a class="code" href="class_f_g_e___motion.html#a693775ca444d08642c4694c5982dcf81">FGE_Motion::Refresh</a> ( <span class="keywordtype">void</span> )
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104         <span class="keywordflow">if</span>(SDL_MUSTLOCK( __pSurfaceBuffer )) {
<a name="l00105"></a>00105        SDL_LockSurface( __pSurfaceBuffer );
<a name="l00106"></a>00106     }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108         <span class="keywordflow">if</span>(SDL_MUSTLOCK( __pSurfaceBuffer )) {
<a name="l00109"></a>00109        SDL_UnlockSurface( __pSurfaceBuffer );
<a name="l00110"></a>00110     }
<a name="l00111"></a>00111   
<a name="l00112"></a>00112     SDL_Flip( __pSurfaceBuffer ); 
<a name="l00113"></a>00113  }
<a name="l00114"></a>00114 
<a name="l00132"></a><a class="code" href="class_f_g_e___motion.html#addb09bbc5e51cef696915490e1936476">00132</a> <span class="keywordtype">int</span> <a class="code" href="class_f_g_e___motion.html#addb09bbc5e51cef696915490e1936476">FGE_Motion::Keyboard</a>( <span class="keywordtype">void</span> )
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134         <span class="keywordflow">while</span>( SDL_PollEvent( &amp;__pEventKeyboard) )
<a name="l00135"></a>00135     {
<a name="l00136"></a>00136                 <span class="keywordflow">if</span>( __pEventKeyboard.type == SDL_QUIT ) 
<a name="l00137"></a>00137                 {
<a name="l00138"></a>00138                         exit(0);
<a name="l00139"></a>00139                 }
<a name="l00140"></a>00140                 
<a name="l00141"></a>00141                 <span class="keywordflow">if</span>( __pEventKeyboard.type == SDL_KEYDOWN ) 
<a name="l00142"></a>00142         { 
<a name="l00143"></a>00143                         <span class="keywordflow">switch</span> ( __pEventKeyboard.key.keysym.sym )
<a name="l00144"></a>00144                         {
<a name="l00145"></a>00145                                 <span class="keywordflow">case</span> SDLK_ESCAPE:
<a name="l00146"></a>00146                                         <span class="keywordflow">return</span> __iKeyPress = 1;
<a name="l00147"></a>00147                                 <span class="keywordflow">break</span>;
<a name="l00148"></a>00148                                 <span class="keywordflow">case</span> SDLK_UP:
<a name="l00149"></a>00149                                         <span class="keywordflow">return</span> __iKeyPress = 2;
<a name="l00150"></a>00150                 <span class="keywordflow">break</span>;
<a name="l00151"></a>00151                                 <span class="keywordflow">case</span> SDLK_DOWN:
<a name="l00152"></a>00152                                         <span class="keywordflow">return</span> __iKeyPress = 3;
<a name="l00153"></a>00153                 <span class="keywordflow">break</span>;
<a name="l00154"></a>00154                                 <span class="keywordflow">case</span> SDLK_LEFT:
<a name="l00155"></a>00155                                         <span class="keywordflow">return</span> __iKeyPress = 4;
<a name="l00156"></a>00156                 <span class="keywordflow">break</span>;
<a name="l00157"></a>00157                                 <span class="keywordflow">case</span> SDLK_RIGHT:
<a name="l00158"></a>00158                                         <span class="keywordflow">return</span> __iKeyPress = 5;
<a name="l00159"></a>00159                 <span class="keywordflow">break</span>;
<a name="l00160"></a>00160                                 <span class="keywordflow">case</span> SDLK_SPACE:
<a name="l00161"></a>00161                                         <span class="keywordflow">return</span> __iKeyPress = 6;
<a name="l00162"></a>00162                 <span class="keywordflow">break</span>;
<a name="l00163"></a>00163                                 <span class="keywordflow">case</span> SDLK_RSHIFT:
<a name="l00164"></a>00164                                         <span class="keywordflow">return</span> __iKeyPress = 7;
<a name="l00165"></a>00165                 <span class="keywordflow">break</span>;
<a name="l00166"></a>00166                                 <span class="keywordflow">case</span> SDLK_LSHIFT:
<a name="l00167"></a>00167                                         <span class="keywordflow">return</span> __iKeyPress = 8;
<a name="l00168"></a>00168                 <span class="keywordflow">break</span>;
<a name="l00169"></a>00169                                 <span class="keywordflow">case</span> SDLK_RCTRL:
<a name="l00170"></a>00170                                         <span class="keywordflow">return</span> __iKeyPress = 9;
<a name="l00171"></a>00171                 <span class="keywordflow">break</span>;
<a name="l00172"></a>00172                                 <span class="keywordflow">case</span> SDLK_LCTRL:
<a name="l00173"></a>00173                                         <span class="keywordflow">return</span> __iKeyPress = 10;
<a name="l00174"></a>00174                 <span class="keywordflow">break</span>;
<a name="l00175"></a>00175                         }
<a name="l00176"></a>00176                 }
<a name="l00177"></a>00177         }
<a name="l00178"></a>00178         <span class="keywordflow">return</span> 0;
<a name="l00179"></a>00179 }
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generado el Sat May 15 12:31:12 2010 para FGElib por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
